/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				ResearchSoftCondition
 
Function						: 				Provides a class for research condition
****************************************************************************/
package planninglanguage.softconditions;

import base.WargusGameState;
import base.WargusPlayer;

public class ResearchSoftCondition extends SoftCondition {
	String m_research;
	int m_playerID;
	
	public ResearchSoftCondition(String a_research,int a_playerID)
	{
		m_research = a_research;
		m_playerID = a_playerID;
	}
	public String toString(int tabs)
	{
		String n = super.toString(tabs);
		n = n + "Research is:" + m_research;
		return n;
		
	}
	public float test(WargusGameState a_gameState)
	{
		System.out.println("ResearchCondition: test( " + m_research + ")");	

		WargusPlayer p = a_gameState.getPlayer(m_playerID);
		
		if (p!=null) {			
			if (p.getResearch().contains(m_research)) return 1.0f;
		}
		return 0.0f;		
	}
}
